/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cardHouse.cards;

import java.util.Vector;
import cardHouse.people.*;
/**
 *
 * @author sam
 */
public class Hand {
    private int          m_currentNumberOfCards; //todo: rename to m_!
    private int          m_maxNumberOfCards;
    private Player       m_handOwner;
    private Vector<Card> m_handContainer; 
    
    public Hand(int maxNumberOfCards, Player handOwner){
        m_maxNumberOfCards = maxNumberOfCards;
        m_handOwner        = handOwner;
        m_currentNumberOfCards  = 0;
        //init handContainer so that it's max is m_maxNumberOfCards
    }

    private Hand(){
        
    }
    
    private Hand(Hand hand){
        
    }

    public void add(Card card){
        m_handContainer.add(card);
    }
    
    //warning: this methiod will thtorw ex. if card not in hand
    public void discard(Card card){
       m_handContainer.remove(card);
    }
    
    
    public Card giveCard(Card card){
       return m_handContainer.remove(m_handContainer.indexOf(card));
    }    
    
    public int getCurrentNumberOfCards(){
        return m_currentNumberOfCards;
    }
    
    public int getMaxNumberOfCards(){
        return m_maxNumberOfCards;
    }

    protected int handOwnerNumber(){
        return this.m_handOwner.getPlayerNumber();
    }

   protected String handOwnerNickName(){
        return m_handOwner.getPlayerNickName();
    }
}
